<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
  </head>
  <body>
    <div id="app">
      <div id="msg">123</div>
      <button onclick="clickButton()">点击</button>
    </div>
  </body>
  <script type="application/javascript">
    let elementForMsg = document.getElementById('msg');

    function clickButton() {
      fetch('https://sit-cn.hero-ee.com:8002/oss/hero-iot-oss-sit/c.txt', {
        method: 'GET',
        headers: {
          'If-None-Match': '00000000000000000000000000000000-1',
        },
      })
        .then(function (response) {
          if (response.status === 200) {
            response.text().then((text) => {
              elementForMsg.innerText = text;
            });
          } else if (response.status === 304) {
            elementForMsg.innerText = 'use cache';
          } else {
            console.log(response);
          }
        })
        .catch((e) => {
          elementForMsg.innerText = e;
        });
    }
  </script>
  <script></script>
</html>
